﻿using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using IDAL;
using Model;

namespace DAL
{
    public class ProductType_ZTE : BaseRepository<ProductType_ZTEInfo>, IProductType_ZTE
    {
        #region 静态变量部分
        private const string PARM_ZTE_PRODUCTTYPEID = "@ProductTypeID";
        private const string PARM_ZTE_ITEMCODE = "@Itemcode";
        private const string PARM_ZTE_MODULETYPE = "@ModuleType";
        private const string PARM_ZTE_VENDER = "@Vender";
        private const string PARM_ZTE_REMARK1 = "@Remark1";
        private const string PARM_ZTE_REMARK2 = "@Remark2";
        private const string PARM_ZTE_REMARK3 = "@Remark3";
        #endregion

        #region 数据检索部分
        public IList<ProductType_ZTEInfo> LoadEntities()
        {
            return ExcuteSqlToGetEntities("ProductType_ZTE_select");
        }

        public ProductType_ZTEInfo LoadEntity<T1>(T1 id)
        {
            SqlParameter parm = GetParameter();
            parm.Value = id;
            return ExcuteSqlToGetEntity("ProductType_ZTE_selectbyID", parm);
        }
        #endregion

        #region 参数部分
        #endregion

        #region 重写基类部分
        //-------------------------------------重写超类基础操作---------------------------------------------------------

        public override ProductType_ZTEInfo GetEntityRecord(SqlDataReader rdr)
        {
            ProductType_ZTEInfo pro = new ProductType_ZTEInfo
            {
                ProductTypeID = rdr.GetValue(0).ToString(),
                Itemcode = rdr.GetValue(1).ToString(),
                ModuleType = rdr.GetValue(2).ToString(),
                Vender = rdr.GetValue(3).ToString(),
                Remark1 = rdr.GetValue(4).ToString(),
                Remark2 = rdr.GetValue(5).ToString(),
                Remark3 = rdr.GetValue(6).ToString()
            };
            return pro;
        }

        public override ProductType_ZTEInfo GetEntityRecord()
        {
            ProductType_ZTEInfo pro = new ProductType_ZTEInfo();
            return pro;
        }

        public override string GetInsertsp()
        {
            return "ProductType_ZTE_Insert";
        }

        public override string GetUpdatesp()
        {
            return "ProductType_ZTE_Update";
        }

        public override string GetDeletesp()
        {
            return "ProductType_ZTE_Delete";
        }

        public override SqlParameter GetParameter()
        {
            SqlParameter Parm = new SqlParameter(PARM_ZTE_PRODUCTTYPEID, SqlDbType.NVarChar, 50);
            return Parm;
        }

        public override SqlParameter[] GetParameters()
        {
            SqlParameter[] parms = null;
            parms = new SqlParameter[]
                {
					new SqlParameter(PARM_ZTE_PRODUCTTYPEID, SqlDbType.NVarChar, 50),
                    new SqlParameter(PARM_ZTE_ITEMCODE, SqlDbType.VarChar, 50),
					new SqlParameter(PARM_ZTE_MODULETYPE, SqlDbType.VarChar, 50),
                    new SqlParameter(PARM_ZTE_VENDER,SqlDbType.VarChar,50),
                    new SqlParameter(PARM_ZTE_REMARK1,SqlDbType.VarChar,50),
                    new SqlParameter(PARM_ZTE_REMARK2,SqlDbType.VarChar,50),
                    new SqlParameter(PARM_ZTE_REMARK3,SqlDbType.VarChar,50)
                };
            return parms;
        }

        public override void SetParameters(ProductType_ZTEInfo pro, params SqlParameter[] Parms)
        {
            Parms[0].Value = pro.ProductTypeID;
            Parms[1].Value = pro.Itemcode;
            Parms[2].Value = pro.ModuleType;
            Parms[3].Value = pro.Vender;
            Parms[4].Value = pro.Remark1;
            Parms[5].Value = pro.Remark2;
            Parms[6].Value = pro.Remark3;
        }
        #endregion
    }
}
